import cv2 as cv
import numpy as np

image = cv.imread(r'chessboard.png',cv.IMREAD_GRAYSCALE)#以灰度方式读取
img=cv.resize(image,(0,0),fx=0.1,fy=0.1) #修改照片尺寸



#Harris = cv.cornerHarris(img,2,3,0.04)
#keypoint = cv.dilate(Harris,None)

Sift = cv.xfeatures2d.SIFT_create()
keypoint_1=Sift.detect(img,None)
SIFTimg=cv.drawKeypoints(img,keypoint_1,image)

Fast = cv.FastFeatureDetector_create()
keypoint_2 = Fast.detect(img,None)
Fastimg=cv.drawKeypoints(img,keypoint_2,image)

ORB=cv.ORB_create()
keypoint_3 = ORB.detect(img,None)
ORBimg = cv.drawKeypoints(img,keypoint_3,image)

#cv.imshow('Harris',Harris)
cv.imshow('SIFT',SIFTimg)
cv.imshow('FAST',Fastimg)
cv.imshow('ORB',ORBimg)

cv.waitKey()